<template>
  <div>
    <input ref="refInput" v-if="isShow"  type="text">
    <button v-else @click="btn">搜索</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
    isShow:false
    };
  },
  methods: {
   async btn() {
      this.isShow=true 
      await this.$nextTick(()=>{
       this.$refs.refInput.focus()
      });
      
    },
  },
};
</script>